package com.hsp.customexception_;

public class CustonException {

    public static void main(String[] args) {
        int age = -1;
        if ( !(age >= 0 && age <= 120 )) {
            throw new AgeException("年龄应该在0~120之间");
        }
        System.out.println("你输入的年龄为" + age);

    }

}
class AgeException extends RuntimeException{
    AgeException(String message) {
        super(message);
    }
}
